#include <dolphin/socket.h>
#define SO_PF_INET 2 // ARPA Internet protocols
#define SO_SOCK_STREAM 1 // stream socket
#define SO_SOCK_DGRAM 2 // datagram socket
int SOSocket ( int pf, int type, int protocol );
SOSocket() creates an unbound socket and returns a socket descriptor.
pf |
Specifies the protocol family in which a socket is to be created.
Currently pf must be SO_PF_INET
(IPv4 Internet protocols). |
type |
Specifies the type of socket to be created. Currently
SO_SOCK_STREAM for TCP and SO_SOCK_DGRAM for UDP are
supported. |
protocol |
Specifies a particular protocol to be used with the socket. If
protocol is zero, the default
protocol for this protocol family and type is used. Currently protocol
must be zero. |
| non-negative | The new socket descriptor. |
SO_EAFNOSUPPORT |
Non-supported address family. |
SO_EMFILE |
No more socket descriptors. |
SO_ENETRESET |
Socket library is not initialized. |
SO_ENOMEM |
Insufficient memory. |
SO_EPROTONOSUPPORT |
Non-supported protocol. |
SO_EPROTOTYPE |
Non-supported socket type. |
Note: Additional errors may be generated and returned in future library releases. All the negative return values must be treated as generic errors.